package com.d3.sx_eprotection.common.pz;

import com.d3.sx_eprotection.intercepter.JWTInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class JwtInterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptor(redisTemplate))
//                .addPathPatterns("/supervisor/*")//拦截
//                .addPathPatterns("/administrator")
                .addPathPatterns("/griders")
                .excludePathPatterns("/login");//排除哪些
    }
}
